<%--
  Created by IntelliJ IDEA.
  User: 78632
  Date: 2022/5/12
  Time: 12:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.3.min.js"></script>
<html>
<head>
    <meta charset="utf-8" >
    <title>注册页面</title>
</head>
<body>
    <form method="get" action="register.action" onsubmit="checker();">
        <label>用户名：
            <input type="text" placeholder="请输入用户名" name="username" id="username"  />
        </label>
        <br />
        <label>密　码：
            <input type="password" placeholder="请输入密码" id="pwd" name="pwd"  />
        </label>
        <label>确认密码：
            <input type="password" placeholder="请再次输入密码" id="repwd" name="repwd"  />
        </label>
        <br />
        <button type="submit">
            提交注册
        </button>
    </form>
<script type="text/javascript">
    function checker() {
        //获取用户名
        var name=$("#username").val();
        var  pass=$("#pwd").val();
        var  repass=$("#repwd").val();
        if (name == null || name == "") {
            alert("账户不能为空");
            return false;
        }
        if (pass==null||pass==""){
            alert("密码不能为空")
            return false;
        }
        if (pass!=repass){
            alert('两次密码不一致');
            return false;
        }
        return  true;
    }
</script>
</body>
</html>
